State the assumptions and split the models into MCDisruptor - #232
Open
lemmy wants to merge 3 commits into
Open
Conversation
The assumptions were already there, but anonymous, so nothing could refer to one: not a proof, not a comment, and not TLC, which names the failing assumption when it reports that one is false. Three of the four repeat what RingBuffer assumes about Size, Writers and Readers. The repetition is not redundant, because TLC ignores the assumptions of an instantiated module, and RingBuffer is instantiated. Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Markus Alexander Kuppe <github.com@lemmster.de>
Both specs require the assumption but neither states it. The variable pc holds one program counter per thread id, so an id in both Writers and Readers shares a single counter between its writer and its reader role. Since pc[t] = "Access" is the sole guard of EndWrite and of EndRead, the Begin action of either role enables the End action of the other. In SPMC, EndWrite after BeginRead advances published past a sequence number that no writer wrote; a consumer then reads the unwritten slot and appends NULL to the consumed history, which violates TypeOk. In MPMC, EndRead after BeginWrite abandons a write in progress and leaves the writer registered in ringbuffer.writers for that slot; a consumer that subsequently enters the slot violates NoDataRaces. Both reports ascribe a defect of the model to the algorithm. Producers and consumers are distinct threads in the Disruptor and every configuration already keeps the two sets disjoint, so the state spaces are unchanged. RingBuffer is not the place for the assumption: TLC ignores the assumptions of an instantiated module, and pc is not declared there. Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Markus Alexander Kuppe <github.com@lemmster.de>
MaxPublished bounds the model rather than the Disruptor. The producers publish without end, and the constant exists solely to keep the sequence numbers and the consumed history finite. StateConstraint and Liveliness are both expressed in terms of it, the latter by quantifying i over a range that ends at MaxPublished, so the constant, its assumption MaxPublishedIsPositive, the constraint and the property move together. Disruptor_SPMC and Disruptor_MPMC now hold the algorithms alone, MCDisruptor_SPMC and MCDisruptor_MPMC the models. The state spaces are unchanged. Liveliness moves verbatim. A comment at its new location records that TLC checks it on the state graph pruned by StateConstraint, in which a behavior may terminate in a state whose successors were all pruned; a positive result is therefore weaker than it appears. The Apalache wrappers declared MaxPublished and their configurations assigned it, although both check NoDataRaces alone, under neither the state constraint nor the property. The declarations and the assignments are removed. Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Markus Alexander Kuppe <github.com@lemmster.de>
Contributor
|
Hi @lemmy , I'll review and revert. Kind regards, |
Member
Author
|
@nicholassm Thanks. What are you going to revert? |
Contributor
|
Sorry, @lemmy - non-native English speaker here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@nicholassm, you contributed this spec: Could you please review and approve the following refactorings?
The goal is to eventually prove properties of the Disruptor, which needs the assumptions stated and named so a proof can cite them, and the model bounds out of the way since they are not part of what would be proved.